package com.yang.springcloud.controller;

import com.netflix.discovery.converters.Auto;
import com.yang.springcloud.pojo.Dept;
import com.yang.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping("/customer")
public class DeptCustomerController {


    @Autowired
    private DeptClientService deptClientService;

    @GetMapping("/dept/add")
    public Boolean add(Dept dept){
        return deptClientService.addDept(dept);
    }

    @RequestMapping("/dept/queryList")
    public List<Dept> queryList(){
        return deptClientService.queryList();
    }

    @RequestMapping("/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
        return deptClientService.queryById(id);
    }

}
